//
//  RABookMallHeaderCell.m
//  ReadApp
//
//  Created by 飞猪 on 2018/11/7.
//  Copyright © 2018年 Facebook. All rights reserved.
//

#import "RABookMallHeaderCell.h"
#import "RABookMallHeaderView.h"

@interface RABookMallHeaderCell ()

@property (nonatomic, strong) UILabel *titleLab;

@end

@implementation RABookMallHeaderCell

- (void)createViews {
  self.backgroundColor = [UIColor whiteColor];
  
  [self.contentView addSubview:self.titleImg];
  self.titleImg.contentMode = UIViewContentModeCenter;
  [self.titleImg mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.mas_equalTo(10.f);
    make.centerX.mas_equalTo(0);
    make.height.mas_equalTo(self.titleImg.mas_width);
  }];
  
  [self.contentView addSubview:self.titleLab];
  [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
    make.centerX.mas_equalTo(0);
    make.bottom.mas_equalTo(-10.f);
  }];
}

- (void)setItemModel:(RABookMallHeaderItemModel *)itemModel {
  _itemModel = itemModel;
  
  self.titleImg.image = [UIImage imageNamed:_itemModel.titleImg];
  self.titleLab.text = _itemModel.title;
}

#pragma mark - Lazyload

- (UILabel *)titleLab {
  if (!_titleLab) {
    _titleLab = [UILabel new];
    _titleLab.font = [UIFont systemFontOfSize:14.f];
    _titleLab.textColor = UIColorHex(666666);
    _titleLab.textAlignment = NSTextAlignmentCenter;
  }
  return _titleLab;
}


@end
